import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

class TestPaddingWidget extends StatefulWidget {
  const TestPaddingWidget({super.key});

  @override
  State<TestPaddingWidget> createState() {
    return _PaddingState();
  }
}

class _PaddingState extends State<TestPaddingWidget> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("基础 Padding ,类似Android的view的padding"),
      ),
      body: SingleChildScrollView(
        scrollDirection: Axis.vertical,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            const Text(">>>>>> 类似Android的view的padding"),
            const Text("\n Padding 会自动的根据当前的View进行外包一层，且大小由被包的宽高+padding = Padding的真实宽高"),
            Container(
              color: Colors.blueGrey,
              child: Padding(
                padding: EdgeInsets.all(20),
                child: Container(
                  color: Colors.red,
                  child: Text("padding = 20"),
                ),
              ),
            ),
            Container(
              color: Colors.blueGrey,
              child: Padding(
                padding: EdgeInsets.all(30),
                child: Container(
                  color: Colors.red,
                  child: Text("padding = 30"),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
